package com.tiancheng.trade.authserver.constant;

/**
 * 系统常量
 */
public class SystemConstant {
    /**
     * 用户token超时时间,单位秒
     */
    public static final long userTokenTimeout = 3600 * 24 * 30;//3600 * 24 * 7;
    /**
     * 应用token超时时间,单位秒
     */
    public static final long applicationTokenTimeout = 3600 * 24 * 2;
    /**
     * oauth2 颁发的code缓存前缀
     */
    public static final String oauth2AuthCodeCachePrefix = "auth:oauth2:auth:code:";
    /**
     * oauth2 颁发的access token缓存前缀
     */
    public static final String oauth2AccessTokenCachePrefix = "auth:oauth2:accessToken:";
    /**
     * oauth2 颁发的code超时时间,单位秒
     */
    public static final long oauth2AuthCodeTimeout = 1800;
    /**
     * oauth2 颁发的access token超时时间,单位秒
     */
    public static final long oauth2AccessTokenTimeout = 3600 * 24 * 7;
    /**
     * 权限id锁前缀
     */
    public static final String permissionIdLockKey = "auth:permission:id:lock:";
    /**
     * 权限应用id和code锁前缀
     */
    public static final String permissionApplicationIdCodeLockKey = "auth:permission:applicationId:code:lock:";
    /**
     * 用户字符串权限缓存key前缀
     */
    public static final String userStringPermissionKey = "userStringPermission:";
    /**
     * 用户字符串角色缓存key前缀
     */
    public static final String userStringRoleKey = "userStringRole:";
    /**
     * 应用权限缓存key前缀
     */
    public static final String applicationPermissionKey = "applicationPermission:";
    /**
     * 应用字符串权限缓存key前缀
     */
    public static final String applicationStringPermissionKey = "applicationStringPermission:";
    /**
     * 应用角色缓存key前缀
     */
    public static final String applicationRoleKey = "applicationRole:";
    /**
     * 应用字符串角色缓存key前缀
     */
    public static final String applicationStringRoleKey = "applicationStringRole:";
    /**
     * 用户oldId与用户的映射key前缀
     */
    public static final String userOldIdMapUserId = "userOldIdMapUserId:";
    /**
     * 小程序登陆的linkSkey映射
     */
    public static final String linkSkeyMap = "auth:linkSkeyMap:";
    /**
     * 密码正则表达式,8到16位至少各包含一个大写字母，一个小写字母，一个数字，一个特殊字符
     */
    public static final String passwordRegEx = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[`!@#$%^&*()-_+={}\\[\\]|,<.>/?;:'\"])[A-Za-z\\d`!@#$%^&*()-_+={}\\[\\]|,<.>/?;:'\"]{8,16}$";
    /**
     * 登陆二维码映射终端id前缀
     */
    public static final String loginQrCodeMapTerminalId = "auth:login:qrCodeMapTerminalId:";
    /**
     * 二维码登陆映射信息
     */
    public static final String qrCodeSignInInfoMap = "auth:qrCode:signInInfo:map:";
    /**
     * 二维码登录的二维码有效期,单位秒
     */
    public static final int qrCodeSignInTimeout = 60;
    /**
     * 二维码登陆队列名称
     */
    public static final String qrCodeSignInQueue = "auth:signIn:qrCodeSignInQueue";
    /**
     * 二维码登陆交换器
     */
    public static final String qrCodeSignInExchange = "auth:signIn:qrCodeSignInExchange";
    /**
     * 用户未绑定手机号标识
     */
    public static final String userIsTourist = "isTourist";
    /**
     * oauth2自定义state映射回调地址
     */
    public static final String oauth2StateMapCallbackKey = "auth:oauth2StateMapCallBack:";

    public static final String xiaoYunHeaderImg = "https://bdc-images-1254950508.cos.ap-guangzhou.myqcloud.com/image/myMoren3x.png";
    /**
     * 密码允许错误次数
     */
    public static final int allowPasswordErrorCount = 5;
    /**
     * 密码错误账户锁定锁定时间,单位秒
     */
    public static final int passwordErrorLockTimeout = 30 * 60;
    /**
     * 验证码有效期,单位分钟
     */
    public static final int captchaCodeTimeout = 30;
    /**
     * 邮箱格式正则
     */
    public static final String emailRegex = "^[a-zA-Z0-9_\\\\.-]+@[a-z0-9\\\\.]+[a-z]+$";

    /**
     * 批量查询限制最大数量
     */
    public static final int maximumQuery = 1000;

    /**
     * ty公众号token,redis前缀
     */
    public static final String tyWeChatOffiaccountTokenResdisKey = "auth:weChatOffiaccount:access_token:";

    /**
     * ty公众号token,redis前缀
     */
    public static final String tyWeChatOffiaccountNextOpenidResdisKey = "auth:weChatOffiaccount:next_openid:";

    public static final String cmqSignSecretKey = "cmq.sign.secret";
    public static final String cmqTemplatePre = "cmq.template.";
}
